/*
 * Copyright (c) 2016. zhaojin 15398699939@163.com
 */

package com.bankscene.screenfit.adapters;


import com.bankscene.screenfit.model.Menus;
import com.bankscene.screenfit.vus.MenusListViewItemVu;

import org.greenrobot.eventbus.EventBus;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by jiiiiiin on 6/14/16.
 */
public class MenusListViewAdapter extends BasePresenterAdapter<MenusListViewItemVu> {

    List<String> titles = new ArrayList<>(Menus.VALUES_MAP.keySet());
    List<Menus> values = new ArrayList<>(Menus.VALUES_MAP.values());

    @Override
    protected void onBindListItemVu(int position) {
        vu.setVal(values.get(position));
    }

    @Override
    protected Class<MenusListViewItemVu> getVuClass() {
        return MenusListViewItemVu.class;
    }

    @Override
    public int getCount() {
        return titles.size();
    }

    @Override
    public Object getItem(int position) {
        return titles.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public static MenusListViewAdapter newInstance(EventBus bus) {
        MenusListViewAdapter menusListViewAdapter = new MenusListViewAdapter();
        menusListViewAdapter.bus = bus;
        return menusListViewAdapter;
    }

}
